using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

namespace BlockOS.Client
{
    public class MainWindow : Window
    {
        [SerializeField]
        private MultiplayerWindow multiplayerWindow;
        [SerializeField]
        private OptionsWindow optionsWindow;

        [SerializeField]
        private InputActionMap mainWindowInputs;

        protected override void Awake()
        {
            mainWindowInputs["Home"].performed += _ => GameClient.Instance.Exit();
        }

        public override void OnShow()
        {
            manager.backgroundColor = Color.black;
            
            mainWindowInputs.Enable();
        }

        public override void OnHide()
        {
            
            mainWindowInputs.Disable();
        }

        protected override void OnDestroy()
        {
            manager.backgroundColor = new Color(0, 0, 0, 0);
        }

        public void OnSinglePlayerButtonDown()
        {
            //GameClient.Instance.ShowToast("Not implemented yet.");
            GameClient.Instance.SetMainStage(new LocalWorld());
        }

        public void OnMultiplayerButtonDown()
        {
            manager.PushWindow(multiplayerWindow);
        }

        public void OnOptionsButtonDown()
        {
            manager.PushWindow(optionsWindow);
        }

        public void OnResourceManageButtonDown()
        {
            GameClient.Instance.ShowToast("Not implemented yet.");
        }
    }
}